﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IOBusiness.LinqDB;

namespace IOBusiness.ClassLinq
{
    public class clsLqTheLoai
    {
        SapaDBDataContext objContext = new SapaDBDataContext();
        public List<tblTheLoai> TheLoai_getTheLoaiByDanhMucId(int idDanhMuc)
        {
            try
            {
                var select = from theloai in objContext.tblTheLoais
                             where theloai.MaDanhMuc.Equals(idDanhMuc)
                             select theloai;
                return select.ToList<tblTheLoai>();
            }
            catch (Exception)
            {

                throw;
            }
        }

        public List<tblTheLoai> TheLoai_getTheLoaiById(int idTheLoai)
        {
            try
            {
                var select = from theloai in objContext.tblTheLoais
                             where theloai.ID.Equals(idTheLoai)
                             select theloai;
                return select.ToList<tblTheLoai>();
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
